9. Experiment: Export up

Take a small very small model and make some experiments

import pandas as pd
from modelclass import model
model.widescreen()

9.1. Load the precooked model

This model was generated from scratch here

msmallmodel,baseline = model.modelload('models/smallmodel.pcim',run=1,keep='Baseline',silent=1)

9.2. Create new dataframe where the export is increased by 10 percent

impuls_x_10pct = baseline.upd("<2024 2027> x % 10")
impuls_x_5pct = baseline.upd("<2024 2027> x % 5")

9.3. Simulate the model

result_x = msmallmodel(impucls_x_10pct,keep='Export increased by 10 percent',alfa=0.2,solver='newton',silent=1)
_ = msmallmodel(impuls_x_5pct,keep='Export increased by 5 percent',alfa=0.2,solver='newton',silent=1)

9.4. Display results

with msmallmodel.set_smpl('2020','2030'):
    display(msmallmodel['y cpv g x m gde' ]) 
msmallmodel['y cpv g  m gde'].difpctlevel.rename().mul100.plot(sharey=True);
../../../_images/modelstart export up_14_0.png
try:
    
    if 1: 
        msmallmodel.modeldash('Y',jupyter=1,inline=0,dashport=5006)
    else:
        print(42)
except Exception as e:
    print(f"Can't run modeldash here")
apprun
Can't run modeldash here
msmallmodel.keep_plot('y m c',diff=1,legend=1);
../../../_images/modelstart export up_17_0.png ../../../_images/modelstart export up_17_1.png
msmallmodel.keep_viz('Y')
msmallmodel.keep_wiz_figs
{'I': <Figure size 720x432 with 1 Axes>,
 'M': <Figure size 720x432 with 1 Axes>,
 'X': <Figure size 720x432 with 1 Axes>,
 'Y': <Figure size 720x432 with 1 Axes>}
yfig = msmallmodel.keep_wiz_figs['Y']
yfig.savefig('graph/GDP.pdf')
!dir graph
 Volume in drive C has no label.
 Volume Serial Number is C2DB-095E

 Directory of c:\wb new\Modelflow\working_paper\thebook\content\howto\smallmodel\graph

28-06-2022  10:21    <DIR>          .
28-06-2022  12:39    <DIR>          ..
28-06-2022  07:49             6.199 A_model_graph.gv
28-06-2022  07:49            92.473 A_model_graph.png
28-06-2022  07:49            12.839 A_model_graph.svg
28-06-2022  12:39            15.058 GDP.pdf
               4 File(s)        126.569 bytes
               2 Dir(s)  790.590.144.512 bytes free
display(yfig)
../../../_images/modelstart export up_23_0.png
msmallmodel.lastdf.to_excel('test.xlsx')
andrew =msmallmodel['y'].pct.mul100.rename().plot()
../../../_images/modelstart export up_25_0.png
andrew
../../../_images/modelstart export up_26_0.png